package com.kmxd.ams.core.common.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

import java.util.Arrays;
import java.util.Objects;

/**
 * 档案利用操作
 *
 * @author nickbi
 */
public enum UseOrderOperateEnum {

  /** 领取登记 */
  RECEIVE(1, "领取登记"),
  /** 删除 */
  RETURN(2, "归还登记"),
  RENEW(3, "续借登记"),
  STOP_USE(4, "终止利用"),
  LOST(5, "无法归还"),
  NOTICE_TO_RECEIVE(6, "通知领取"),
  RECALL(7, "催还"),
  PRINT(8, "打印"),
  ;

  @EnumValue private final Integer type;
  private final String desc;

  @JsonValue
  public Integer getType() {
    return type;
  }

  public String getDesc() {
    return desc;
  }

  UseOrderOperateEnum(Integer type, String desc) {
    this.type = type;
    this.desc = desc;
  }

  @JsonCreator
  public static UseOrderOperateEnum getValue(Integer type) {
    return Arrays.stream(values()).filter(x -> Objects.equals(x.type, type)).findAny().orElse(null);
  }
}
